﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessLogic.Model;
using BusinessLogic;

namespace Mvp
{
    public static class UrlUtilities
    {
        public static string GenerateCommentUrl(Comment comment, int pageNumber)
        {
            return "~/ViewNewsItem.aspx?" +
                //add the NewsItemID to the URL
                QueryStringConstants.NewsItemID + "=" + comment.NewsItem.NewsItemID +
                //add the page to the URL if it is not the first page
                (pageNumber == 1 ? "" : ("&" + QueryStringConstants.Page + "=" + pageNumber)) +
                //add the anchor to the target comment to the URL
                "#" + UrlAnchorConstants.Comment + comment.CommentID;
        }
    }
}
